home *** CD-ROM | disk | FTP | other *** search
/ MaxiMac 2000 December / MaxiMac 109.iso / Macworld on CD n°109 / Applications (Mac OS X PB) / MacOSX ScreenSavers / Source Code / Paper Airplanes / GLPlane.m < prev    next >
Encoding:
Text File  |  2000-10-02  |  887 b   |  62 lines  |  [????/????]

  1. #import "GLPlane.h"
  2.  
  3. #import "OpenGLplane.c"
  4.  
  5. @implementation GLPlane    
  6.  
  7. - (id)initWithFrame:(NSRect)frameRect
  8. {
  9.     self = [super initWithFrame:frameRect];
  10.     if (self) {
  11.         _view = [[NSOpenGLView alloc] initWithFrame:frameRect];
  12.         [self addSubview:_view];
  13.     }
  14.     
  15.     return self;
  16. }
  17.  
  18. - (NSTimeInterval)animationTimeInterval
  19. {
  20.     return 0.01;
  21. }
  22.  
  23. - (void)setFrameSize:(NSSize)newSize
  24. {
  25.     [super setFrameSize:newSize];
  26.     [_view setFrameSize:newSize];
  27.     _initedGL = NO;
  28.  
  29. }
  30.  
  31. - (void)drawRect:(NSRect)rects
  32. {
  33.     
  34.     [_view lockFocus];
  35.     
  36.     if (!_initedGL) {
  37.         init_plane();
  38.         draw_plane();
  39.  
  40.         _initedGL = YES;
  41.     }
  42.  
  43.     [_view unlockFocus];
  44. }
  45.  
  46.  
  47. - (void)oneStep
  48. {
  49.     [_view lockFocus];
  50.     animate_plane();
  51.     [_view unlockFocus];
  52.  
  53.     
  54.     return;
  55. }
  56.  
  57.  
  58. - (BOOL)hasConfigureSheet { return NO; }
  59. - (NSWindow*)configureSheet { return nil; }
  60.  
  61. @end
  62.